package com.gupaoedu.mvcframework.v2.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 64174
 * @date 2020/2/22 21:27
 * @description
 */

public class GPDispatcherServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doDispatch();
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        // 1.加载配置文件
        doLoadConfig(config.getInitParameter());

        // 2.扫描相关的类
        doScanner();

        // 3.实例化相关的类
        doInstance();

        //4.完成依懒注入
        doAutowied();

        //5.初始化HandlerMapping
        doInitHandlerMapping();

        //6.调用
        doDispatch();


    }

    private void doDispatch() {
    }

    private void doInitHandlerMapping() {
        
    }

    private void doInstance() {
    }

    private void doAutowied() {
    }

    private void doScanner() {
    }

    private void doLoadConfig() {
    }
}
